FILE_WHICH
The FILE_WHICH function separates a specified file path into its component directories, and searches each directory in turn for a specific file. This command is modeled after the UNIX which(1)
command, but is written in the IDL language and is available on all platforms. Its source code can be found in the file file_which.pro
in the lib
subdirectory of the IDL distribution.
Examples
To find the location of the file_which.pro
file:
Result = FILE_WHICH('file_which.pro')
To find the location of the UNIX ls
command:
Result = FILE_WHICH(getenv('PATH'), 'ls')
Syntax
Result = FILE_WHICH( [Path, ] File [, /INCLUDE_CURRENT_DIR] )
Return Value
Returns the path for the first file for the given name found by searching the specified path. If FILE_WHICH does not find the desired file, an empty string is returned.
Arguments
Path
A search path to be searched. If Path is not present, the value of the IDL !PATH system variable is used.
File
The file to look for in the directories given by Path.
Keywords
INCLUDE_CURRENT_DIR
If set, FILE_WHICH looks in the current directory before starting to search Path for File. When IDL searches for a routine to compile, it looks in the current working directory before searching !PATH. The INCLUDE_CURRENT_DIR keyword allows FILE_WHICH to mimic this behavior.
Version History
5.4 |
Introduced |